package org.sam.swing;

import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.sam.swing.format.LatitudeFormatter;
import org.sam.swing.format.LongitudeFormatter;

/**
 * 用来测试个别输入控件的测试窗口
 * 
 * @author sam
 *
 */
public class JInputTestFrame extends JFrame {

	private static final long serialVersionUID = 5607889928520342721L;

	private JInputPanel panel;

	/**
	 * 用来测试个别输入控件的测试窗口
	 */
	public JInputTestFrame() {
		panel = new JInputPanel();
		this.setContentPane(panel);
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}

	/**
	 * 输入测试对象
	 * 
	 * @author sam
	 *
	 */
	private class JInputPanel extends JPanel {

		private static final long serialVersionUID = -2720499939358531453L;

		/**
		 * 经度输入框
		 */
		private JFormattedTextField txtLong;
		
		/**
		 * 纬度输入框
		 */
		private JFormattedTextField txtLat;

		/**
		 * 加入经纬度校验控件
		 */
		private JInputPanel() {
			this.setLayout(null);
			JLabel lblLong = new JLabel("经度:");
			lblLong.setBounds(5, 5, 50, 28);
			this.add(lblLong);
			
			txtLong = new JFormattedTextField(new LongitudeFormatter());
			txtLong.setBounds(60, 5, 75, 28);
			
			this.add(txtLong);
			
			JLabel lblLat = new JLabel("纬度:");
			lblLat.setBounds(5, 35, 50, 28);
			this.add(lblLat);
			
			txtLat = new JFormattedTextField(new LatitudeFormatter());
			txtLat.setBounds(60, 35, 75, 28);
			
			this.add(txtLat);
		}

	}
}
